//
//  CoachsBookTagViewCell.m
//  CoachsBook
//
//  Created by huiyong li on 2022/8/25.
//

#import "CoachsBookTagViewCell.h"

@interface CoachsBookTagViewCell()<LongTagViewDelegate>
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) LongTagView *tagView;
@property (nonatomic, strong) UIView *lineView;
@property (nonatomic, strong) NSMutableArray *dataSource;
@property (nonatomic,assign) NSInteger chooseTag;
@end

@implementation CoachsBookTagViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier])
    {
        [self setViews];
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)setViews
{
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(16, 10, 120, 30)];
    self.titleLabel.font = kPingFangRegular(16);
    self.titleLabel.textColor = rgba(51, 51, 51, 1);
    
    
    self.tagView = [[LongTagView alloc]initWithFrame: CGRectMake(11, 45, APPwidth-22, 60)];
    self.tagView.textColorNormal = rgba(51, 51, 51, 1);
    self.tagView.backgroundColorNormal = rgba(245, 245, 250, 1);
    self.tagView.textColorSelected = rgba(255, 255, 255, 1);
    self.tagView.backgroundColorSelected = rgba(22, 120, 255, 1);
    self.tagView.textFontNormal = kPingFangRegular(14);
    self.tagView.btnH = 28;
    self.tagView.multiselect = YES;
    self.tagView.widthNumber = 3;
    self.tagView.automaticWidth = NO;
    self.tagView.Delegate = self;
    
    
    
    
    
    self.lineView = [[UIView alloc]initWithFrame:CGRectMake(16, 49, APPwidth-32, 1)];
    self.lineView.backgroundColor = rgba(245, 245, 245, 1);
    
    
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.tagView];
    [self.contentView addSubview:self.lineView];
    
}

-(void)cellFillWithModel:(CoachsBookInputModel *)model
{
    
    self.titleLabel.text = model.title;
    self.tagView.tagArray = model.tagArr;
    self.tagView.maxnumber = model.tagArr.count;
}

- (void)getViewHeight:(CGFloat)height
{
    NSLog(@"height == %f",height);
    self.tagView.frame = CGRectMake(11, 45, APPwidth-22, height);
    self.lineView.frame = CGRectMake(16, height+45+14, APPwidth-32, 1);
    
    
}

- (void)DeleteWithTagViewTitleArr:(NSArray *)titilearr
{
    if (self.setTagViewTitleArrBlock) {
        self.setTagViewTitleArrBlock(titilearr);
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
